{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}

{% block toolbar %}
    {% if collector.counterrors %}
        {% set icon %}
            <img width="15" height="28" alt="Logs" style="border-width: 0; vertical-align: middle; margin-right: 5px;" src=""/>
        {% endset %}
        {% set text %}
            <span>{{ collector.counterrors }}</span>
        {% endset %}
        {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
    {% endif %}
{% endblock %}

{% block menu %}
<span class="label">
    <span class="icon"><img src="{{ asset('bundles/webprofiler/images/profiler/logger.png') }}" alt="Logger" /></span>
    <strong>Logs</strong>
    {% if collector.counterrors %}
        <span class="count">
            <span>{{ collector.counterrors }}</span>
        </span>
    {% endif %}
</span>
{% endblock %}

{% block panel %}
    <h2>Logs</h2>

    {% if collector.logs %}
        <ul class="alt">
            {% for log in collector.logs %}
                <li class="{{ cycle(['odd', 'even'], loop.index) }}{% if 'ERR' == log.priorityName or 'ERROR' == log.priorityName %} error{% endif %}">
                    {{ log.message }}
                    {% if log.context is defined and log.context is not empty %}
                        <br />
                        <small>
                            <strong>Context</strong>: {{ log.context|yaml_encode }}
                        </small>
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
    {% else %}
        <p>
            <em>No logs available.</em>
        </p>
    {% endif %}
{% endblock %}
